package r25.tools;

import java.util.UUID;

/**
 * <p>
 * IdGenerator class.
 * </p>
 * A helper to generate random, unique IDs as {@link java.lang.String} eg
 * 0437b55e-6f5f-42de-b732-fe8fd5b5b960 or long eg -911628203 without the need
 * of a database sequence generator
 * 
 * @author <a href="mailto:philippe.bajoit@ulg.ac.be">PB</a>
 * @version 0.0.1
 */
public class IdGenerator {
	/**
	 * <p>
	 * createId
	 * </p>
	 * 
	 * @return a {@link java.lang.String} UUID.
	 */
	public static String createId() {
		UUID uuid = java.util.UUID.randomUUID();
		return uuid.toString();
	}

	/**
	 * <p>
	 * createLongId
	 * </p>
	 * 
	 * @return a long UUID.
	 */
	public static long createLongId() {
		UUID uuid = java.util.UUID.randomUUID();
		return uuid.hashCode();
	}
}
